package top.xiaoazi.futureletterserver;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ConfigurableApplicationContext;
import top.xiaoazi.futureletterserver.module.letter.utils.LetterPushUtils;

@SpringBootApplication
@EnableCaching
public class FutureLetterServer {

    public static ConfigurableApplicationContext context;

    public static void setUp() {
        // 发送信件
        LetterPushUtils letterPushUtils = context.getBean(LetterPushUtils.class);
        letterPushUtils.push();
    }

    public static void main(String[] args) {
        context = SpringApplication.run(FutureLetterServer.class, args);
        setUp(); // 启动 springboot 后的前置操作
    }
}
